package com.atguigu.spzx.manager.service.impl;

import com.atguigu.spzx.manager.mapper.SysUserMapper;
import com.atguigu.spzx.manager.service.ForgetPasswordServicce;
import com.atguigu.spzx.model.dto.system.ForgetPasswordDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

@Service
public class ForgetPasswordServiceImpl implements ForgetPasswordServicce {
    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public void updataPassword(ForgetPasswordDto forgetPasswordDto) {
        String secondPassword = forgetPasswordDto.getSecondPassword();
        String md5password = DigestUtils.md5DigestAsHex(secondPassword.getBytes());
        forgetPasswordDto.setSecondPassword(md5password);
        sysUserMapper.updatePassword(forgetPasswordDto);
    }
}
